
@ECHO off
REM
REM Script to create the CSP Public Portal Web Application
REM Last Updated: 30/05/2008

if "%1" == "/?" GOTO Help
if "%1" == "" GOTO Help

if EXIST "%commonprogramfiles%\Microsoft Shared Debug\web server extensions\12\BIN\stsadm.exe" (
     SET STSADM="%commonprogramfiles%\Microsoft Shared Debug\web server extensions\12\BIN\stsadm.exe"
)

if EXIST "%commonprogramfiles%\Microsoft Shared\web server extensions\12\BIN\stsadm.exe" (
     SET STSADM="%commonprogramfiles%\Microsoft Shared\web server extensions\12\BIN\stsadm.exe"
)

if NOT EXIST %STSADM% (
    ECHO Error:  STSADM.EXE cannot be found in your system.
    GOTO Error
    )
ECHO.
ECHO Creating %1 Web Application ...

if "%5" == "" GOTO NetworkService
%STSADM% -o extendvs -url %1 -description %2 -ownerlogin %3 -owneremail %4 -donotcreatesite -allowanonymous -apidname csp-intranetapppool -apidtype configurableid -apidlogin %5 -apidpwd %6
GOTO Continue

:NetworkService
%STSADM% -o extendvs -url %1 -description %2 -ownerlogin %3 -owneremail %4 -donotcreatesite -allowanonymous -apidname csp-intranetapppool

:Continue
 
 
if NOT %ERRORLEVEL% == 0 (
        ECHO Error:  Error running stsAdm
        GOTO Error
        )

ECHO.
ECHO ********************************
ECHO %1 has been created
ECHO ********************************
ECHO.
PAUSE
GOTO End

:Error
ECHO.
ECHO ********************************
ECHO Failed!
ECHO ********************************
ECHO.
PAUSE
GOTO End

:Help
ECHO.
ECHO The command line syntax:
ECHO    CreateWebApplication http://<servername>/<customsite>
ECHO    CreateWebApplication \\<Servername>\<Foldername> unc
ECHO.
ECHO Examples:
ECHO    C:\CreateWebApplication http://<servername>/<customsite>
ECHO    C:\CreateWebApplication \\<Servername>\<Foldername> unc
PAUSE
GOTO End
:End